import { BasicColumn } from '@/components/Table';
import { FormSchema, commonRules } from '@/components/Form';
import { useRender } from '@/hooks/component/useRender';
import { IconEnum } from '@/enums/appEnum';
import { getDictOptions } from '@/utils/dict';
import { DictEnum } from '@/enums/dictEnum';
export const formSchems: FormSchema[] = [
  {
    field: 'createTime',
    label: '下单日期',
    component: 'RangePicker',
  },
  {
    field: 'status',
    label: '状态',
    component: 'Select',
    componentProps: {
      options: getDictOptions(DictEnum.NORMAL_DISABLE),
    },
  },
];

export const columns: BasicColumn[] = [
  {
    title: '供应商编号#',
    dataIndex: 'productDetailsContactsName',
  },
  {
    title: '供应商名称',
    dataIndex: 'productEmail',
  },
  {
    title: '网址',
    dataIndex: 'productLabel',
  },
  {
    title: '联系人',
    dataIndex: 'productCountryId',
  },
  {
    title: '联系电话',
    dataIndex: 'productSource',
  },
  {
    title: '价格',
    dataIndex: 'orderSumMoney',
  },
  {
    title: '起订量',
    dataIndex: 'productTotalOrders',
  }
];
const { renderIcon } = useRender();
export const drawerSchemas: FormSchema[] = [
  {
    label: '客户编号',
    field: 'productId',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '客户名称',
    field: 'productName',
    required: true,
    component: 'Input',
  },
  {
    label: '业务员',
    field: 'userId',
    required: false,
    component: 'Select',
    componentProps: {
      options: [],
      allowClear: false,
    },
  },
  {
    label: '别名',
    field: 'productAlias',
    required: false,
    component: 'Input',
  },
  {
    label: '国家/地区',
    field: 'productCountryId',
    required: true,
    component: 'Select',
    componentProps: {
      allowClear: false,
      options: getDictOptions(DictEnum.COUNTRY),
    },
  },
  {
    label: '币种',
    field: 'productCurrency',
    required: true,
    component: 'Select',
    componentProps: {
      allowClear: false,
      options: getDictOptions(DictEnum.CURRENCY),
    },
  },
  {
    label: '标签',
    field: 'productLabel',
    required: false,
    slot: 'productLabel',
  },
  {
    label: '客户评级',
    field: 'productRating',
    required: false,
    slot: 'productRating',
  },
  {
    label: '联系电话',
    field: 'productCompanyOfficeNumber',
    component: 'Input',
    rules: commonRules('phone'),
    renderComponentContent() {
      return {
        addonBefore: () => renderIcon(IconEnum.PHONE),
      };
    },
  },
  {
    label: '邮箱',
    field: 'productEmail',
    component: 'Input',
    rules: commonRules('email'),
    renderComponentContent() {
      return {
        addonBefore: () => renderIcon(IconEnum.EMAIL),
      };
    },
  },
  // {
  //   label: '传真',
  //   field: 'value',
  //   required: true,
  //   component: 'Input',
  // },
  {
    label: '网站',
    field: 'productWebsite',
    required: false,
    component: 'Input',
  },
  {
    label: '客户来源',
    field: 'productSource',
    required: false,
    component: 'Select',
    componentProps: {
      allowClear: false,
      options: getDictOptions(DictEnum.CUSTOMER_SOUCE),
    },
  },
  {
    label: '成立日期',
    field: 'productDateOfEstablishment',
    required: false,
    component: 'DatePicker',
  },
  {
    label: '备注',
    field: 'productRemarks',
    required: false,
    component: 'InputTextArea',
    componentProps: {
      rows: 3,
    },
  },
  {
    label: 'Logo',
    field: 'productAvatar',
    required: false,
    slot: 'productAvatar',
  },
];
